<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		
		<script>
			//对象的 __proto__ 属性
			function Person(name){
				this.name = name;
			}
			
			Person.prototype.sayHello = function(){
				console.log("Hello, my name is "+this.name);
			}
			
			let alice = new Person("Alice");
			alice.sayHello();
			
			//修改原型
			Person.prototype.sayGoodbye = function(){
				console.log("Goodbye form "+this.name);
			}
			alice.sayGoodbye();
			
			//Object.create 方法
			let personPrototype = {
				sayHello: function(){
					console.log("Hello, my name is "+this.name);
				}
			};
			let alice1 = Object.create(personPrototype);
			alice1.name = "Alice";
			alice1.sayHello();
		</script>
	</body>
</html>